package Test2;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        FileWriter fw = null;
            try {
                fw = new FileWriter("src/Test2/abc.txt");
                while(true){
                    Scanner sc = new Scanner(System.in);
                    String s = sc.nextLine();
                    if(s.equals("end")){
                        break;
                    }else{
                        StringBuffer sb = new StringBuffer(s);
                        sb.reverse();
                        fw.write(sb.toString());
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }finally {
                if( null != fw){
                    try {
                        fw.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }

    }

    }


